﻿/*

========================================================================

	                        Light Prepass Renderer

		                        by Floris Groen

                         E-mail : fmfgroen@yahoo.com
                     Blog : www.florisgroen.blogspot.com
		      

========================================================================

*/

using System.Collections.Generic;
using LightPrePassRenderer.Engine.Interfaces;
using Microsoft.Xna.Framework;

namespace LightPrePassRenderer.Engine
{
    public struct RenderEntry
    {
        public ModelInstance ModelInstance;
        public Material Material;
        public Matrix World;
    };

    /// <summary>
    /// Simple render manager. Contains a list of models to render.
    /// </summary>
    public class RenderManager : IRenderManager
    {
        List<RenderEntry> renderQueue = new List<RenderEntry>();

        public Camera Camera
        {
            get;
            set;
        }

        public void AddToRenderQueue(ModelInstance modelInstance, ref Matrix world, Material material)
        {
            var renderEntry = new RenderEntry
            {
                ModelInstance = modelInstance,
                Material = material,
                World = world
            };

            renderQueue.Add(renderEntry);
        }

        public int QueueCount
        {
            get { return renderQueue.Count; }
        }

        public RenderEntry GetRenderQueueItem(int index)
        {
            return renderQueue[index];
        }

        public void ClearRenderQueue()
        {
            renderQueue.Clear();
        }
    }
}
